#include <iostream>
#include "complex.h"

// using directive 使用命令，标准库都在std中
using namespace std;

// using declaration 使用声明
using std::cout;

ostream& operator<<(ostream& os, const complex& x) {
    return os << '(' << real(x) << ',' << imag(x) << ')';
}

int main(void) {

    complex c(); // complex(double r = 0, double i = 0) : re(r), im(i)

    complex c1(2, 1);
    complex c2(4, 0);

    cout << c1 << endl;
    cout << c2 << endl;

    cout << c1 + c2 << endl;
    cout << c1 - c2 << endl;
    cout << c1 * c2 << endl;
    cout << c1 / 2 << endl;

    cout << conj(c1) << endl;
    cout << norm(c1) << endl;
    cout << polar(10, 4) << endl;

    cout << (c1 += c2) << endl;

    cout << (c1 == c2) << endl;
    cout << (c1 != c2) << endl;
    cout << +c2 << endl;
    cout << -c2 << endl;

    cout << (c2 - 2) << endl;
    cout << (5 + c2) << endl;

    return 0;
}
/*
object based基于对象：面对的是单一class的设计
object oriented面向对象：面对的是多重classes的设计，classes和classes之间的关系

classes的两个经典分类：class without pointer mumber和class with pointer member
*/